<?php
require(dirname(__FILE__) .'/check.php');
$skin->CheckIframe();


/* **** 版权所有 ****

 程序开发：网钛科技
 网钛CMS官网：http://otcms.com
 网钛IDC官网：http://idccms.com
 ＱＱ：877873666
 微信：tudougeaini
 邮箱：877873666@qq.com

 **** 版权所有 **** */


//用户检测
$MB->Open('','login',2);


@ini_set('max_execution_time', 0);
@set_time_limit(0); 


switch ($mudi){
	case 'add':
		$menuFileID = 9;
		$MB->IsSecMenuRight('alertBack',$menuFileID,$dataType);
		AddOrRev();
		break;

	case 'rev':
		$menuFileID = 10;
		$MB->IsSecMenuRight('alertBack',$menuFileID,$dataType);
		AddOrRev();
		break;

	case 'del':
		$menuFileID = 11;
		$MB->IsSecMenuRight('alert',$menuFileID,$dataType);
		del();
		break;

	case 'moreDel':
		$menuFileID = 11;
		$MB->IsSecMenuRight('alertBack',$menuFileID,$dataType);
		MoreDel();
		break;

	case 'infoContentDel':
		$menuFileID = 11;
		$MB->IsSecMenuRight('alert',$menuFileID,$dataType);
		InfoContentDel();
		break;

	case 'infoContentMoreDel':
		$menuFileID = 11;
		$MB->IsSecMenuRight('alertBack',$menuFileID,$dataType);
		InfoContentMoreDel();
		break;

	case 'moreMove':
		$menuFileID = 10;
		$MB->IsSecMenuRight('alertBack',$menuFileID,$dataType);
		MoreMoveDeal();
		break;

	case 'moreAddi':
		$menuFileID = 10;
		$MB->IsSecMenuRight('alertBack',$menuFileID,$dataType);
		MoreAddiDeal();
		break;

	case 'moreSet':
		$menuFileID = 10;
		$MB->IsSecMenuRight('alertBack',$menuFileID,$dataType);
		MoreSetDeal();
		break;

	case 'allSet':
		$menuFileID = 10;
		$MB->IsSecMenuRight('alertBack',$menuFileID,$dataType);
		AllSetDeal();
		break;

	case 'resDeal':
		$menuFileID = 10;
		$MB->IsSecMenuRight('alert',$menuFileID,$dataType);
		ResDeal();
		break;

	case 'autoImg':
		$menuFileID = 10;
		$MB->IsSecMenuRight('alert',$menuFileID,$dataType);
		AppAutoImg::InfoMake();
		break;

	default:
		die('err');
}

$MB->Close();
$DB->Close();




//添加、修改
function AddOrRev(){
	global $DB,$MB,$skin,$mudi,$menuFileID,$menuTreeID,$sysAdminArr,$systemArr,$sysImagesArr;

	$userSysArr = Cache::PhpFile('userSys');

	$backURL		= OT::PostStr('backURL');
	$dataType		= OT::PostStr('dataType');
	$dataTypeCN		= OT::PostStr('dataTypeCN');
	$dataMode		= OT::PostStr('dataMode');
	$dataModeStr	= OT::PostStr('dataModeStr');
	$dataID			= OT::PostInt('dataID');

	$themeTime		= OT::PostStr('time');
	$userID			= 0;
	$username		= OT::PostStr('username');
	$isOri			= OT::PostInt('isOri');
	$theme			= OT::PostStr('theme');
	$themeMd5		= md5($theme);
	$themeB			= OT::PostInt('themeB');
	$themeColor		= OT::PostStr('themeColor');
	$themeStyle		= '';
		if ($themeB == 1){ $themeStyle .= 'font-weight:bold;'; }
		if ($themeColor != ''){ $themeStyle .= 'color:'. $themeColor .';'; }
	$isTitle		= OT::PostInt('isTitle');
	$titleAddi		= OT::PostStr('titleAddi');
	$template		= OT::PostStr('template');
	$templateWap	= OT::PostStr('templateWap');
	$source			= OT::PostStr('source');
	$writer			= OT::PostStr('writer');
	$topicList		= OT::Post('topicList');
		if (is_array($topicList)){ $topicList = ','. implode(',',$topicList) .','; }
	$typeStr		= OT::PostStr('typeStr');

	$itArr = Info::InfoTypeArr($typeStr);
	$type1ID	= $itArr['type1ID'];
	$type2ID	= $itArr['type2ID'];
	$type3ID	= $itArr['type3ID'];
	$typeCurrID	= $itArr['typeCurrID'];

	$webURL			= OT::PostStr('webURL');
	$isEncUrl		= OT::PostInt('isEncUrl');
	$oldTabID		= OT::PostInt('oldTabID');
	$tabID			= OT::PostInt('tabID');
	$content		= Adm::FilterEditor(OT::Post('content'));
	$encContent		= Adm::FilterEditor(OT::Post('encContent'));
	$upImgStr		= OT::PostStr('upImgStr');
		if (strlen($upImgStr) > 1){ $upImgStr = substr($upImgStr,0,-1); }
	$mediaFile		= OT::PostStr('mediaFile');
	$mediaEvent		= OT::PostArrStr('mediaEvent',',');

	$newUpImgStr	= ServerFile::EditorImgStr($upImgStr, $content . $encContent);
	$themeKey		= OT::PostStr('themeKey');
		if ($themeKey != ''){ $themeKey = Info::FilterThemeKey($themeKey); }
	$contentKey		= Info::FilterContentKey(OT::PostRStr('contentKey'));
		if ($contentKey == ''){ $contentKey = Str::LimitChar(Info::FilterContentKey($content),140) .'...'; }
	$isRenameFile	= OT::PostInt('isRenameFile');
	$isUserFile		= OT::PostInt('isUserFile');
	$fileName		= OT::PostStr('fileName');	// 废弃，后期删除，已用 $fileStr 代替
	$file			= OT::PostStr('file');		// 废弃，后期删除，已用 $fileStr 代替
	$fileNum		= OT::PostInt('fileNum');
		$fileStr = '';
		if ($fileNum > 0){
			for ($i=1; $i<=$fileNum; $i++){
				if (strlen($fileStr) > 0){ $fileStr .= '<arr>'; }
				$fileStr .= OT::PostStr('file'. $i) .'|'. ($isRenameFile == 1 ? OT::PostRegExpStr('fileName'. $i,'sql') : OT::PostStr('fileName'. $i)) .'|'. OT::PostStr('fileRnd'. $i) .'|'. OT::PostStr('filePwd'. $i) .'|';
			}
		}
	$isSaveContImg	= OT::PostInt('isSaveContImg');
	$isSaveImg		= OT::PostInt('isSaveImg');
	$pageNum		= OT::PostInt('pageNum');
	$addition		= OT::PostArrStr('addition',',');
	$isAudit		= OT::PostInt('isAudit');
	$isNew			= OT::PostInt('isNew');
	$isHomeThumb	= OT::PostInt('isHomeThumb');
	$isThumb		= OT::PostInt('isThumb');
	$isImg			= OT::PostInt('isImg');
	$isFlash		= OT::PostInt('isFlash');
	$isMarquee		= OT::PostInt('isMarquee');
	$isRecom		= OT::PostInt('isRecom');
	$isTop			= OT::PostInt('isTop');
	$img			= OT::PostStr('img');
	$voteMode	= OT::PostInt('voteMode');
	$voteStr	= '';
		if ($voteMode == 1){
			$voteItem1	= OT::PostInt('voteItem1');
			$voteItem2	= OT::PostInt('voteItem2');
			$voteItem3	= OT::PostInt('voteItem3');
			$voteItem4	= OT::PostInt('voteItem4');
			$voteItem5	= OT::PostInt('voteItem5');
			$voteItem6	= OT::PostInt('voteItem6');
			$voteItem7	= OT::PostInt('voteItem7');
			$voteItem8	= OT::PostInt('voteItem8');
			$voteStr = $voteItem1 .','. $voteItem2 .','. $voteItem3 .','. $voteItem4 .','. $voteItem5 .','. $voteItem6 .','. $voteItem7 .','. $voteItem8;
		}elseif ($voteMode == 2){
			$voteItem11	= OT::PostInt('voteItem11');
			$voteItem12	= OT::PostInt('voteItem12');
			$voteStr = $voteItem11 .','. $voteItem12 .',0,0,0,0,0,0';
		}
	$isMarkNews		= OT::PostInt('isMarkNews');
	$isReply		= OT::PostInt('isReply');
	$topAddiID		= OT::PostInt('topAddiID');
	$addiID			= OT::PostInt('addiID');
	$readNum		= OT::PostInt('readNum');
	$state			= OT::PostInt('state');
	$wapState		= OT::PostInt('wapState');
	$isCheckUser	= OT::PostInt('isCheckUser');
	$freeGroupList	= OT::PostArrStr('freeGroupList',',');
	$userGroupList	= OT::PostArrStr('userGroupList',',');
	$userLevel		= OT::PostInt('userLevel');
	$score1			= OT::PostInt('score1');
	$score2			= OT::PostInt('score2');
	$score3			= OT::PostInt('score3');
	$cutScore1		= OT::PostInt('cutScore1');
	$cutScore2		= OT::PostInt('cutScore2');
	$cutScore3		= OT::PostInt('cutScore3');
	$isEnc			= OT::PostInt('isEnc');
	$isSitemap		= OT::PostInt('isSitemap');
	$isXiongzhang	= OT::PostInt('isXiongzhang');
	// $bdPing			= OT::PostInt('bdPing',9);
	$auditNote		= OT::PostStr('auditNote');
	$resBaidu		= OT::PostInt('resBaidu');
	$res360			= OT::PostInt('res360');
	$resSogou		= OT::PostInt('resSogou');
	$resShenma		= OT::PostInt('resShenma');
	$resToutiao		= OT::PostInt('resToutiao');
	$resBing		= OT::PostInt('resBing');
	$cutQuickMoney	= OT::PostFloat('cutQuickMoney');
	$pwdAnswer		= OT::PostStr('pwdAnswer');
	$pwdImg			= OT::PostStr('pwdImg');
	$pwdNote		= OT::PostStr('pwdNote');
	$prevNewsId		= OT::PostInt('prevNewsId');
	$nextNewsId		= OT::PostInt('nextNewsId');
	$themeKeyIdEmpty= OT::PostInt('themeKeyIdEmpty');
	$isAutoImg		= OT::PostInt('isAutoImg');
	$videoID		= OT::PostInt('videoID');
	$payUserMul		= OT::PostInt('payUserMul');
	$field1			= OT::PostStr('field1');
	$field2			= OT::PostStr('field2');
	$field3			= OT::PostStr('field3');
	$revID			= OT::PostInt('revID');
	$revIDJud		= OT::PostInt('revIDJud');
	$mediaPcW		= OT::PostStr('mediaPcW');
	$mediaPcH		= OT::PostStr('mediaPcH');
	$mediaWapW		= OT::PostStr('mediaWapW');
	$mediaWapH		= OT::PostStr('mediaWapH');

	$isChangeInfoTypeDir = OT::PostInt('isChangeInfoTypeDir');
	$isChangeDatetimeDir = OT::PostInt('isChangeDatetimeDir');

	if ($themeTime=='' || $theme=='' || $typeStr==''){
		JS::AlertBackEnd('表单内容接收不全.');
	}

	$infoSysArr = Cache::PhpFile('infoSys');

	/*
	// 伪原创
	if (strpos($addition,'|themeAppr|') !== false){
		$theme = ApprWord_Get($theme);
	}
	if (strpos($addition,'|contentAppr|') !== false){
		$content = ApprWord_Get($content);
	}
	*/
	$isCheckUser = 0;
	if (strpos($addition,'|checkUser|') !== false){
		$isCheckUser += 10;
	}
	if (strpos($addition,'|checkReply|') !== false){
		$isCheckUser += 10;
	}
	if (strpos($addition,'|checkQuick|') !== false){
		$isCheckUser += 10;
		if ($cutQuickMoney <= 0){ $cutQuickMoney = 9999; }
	}
	if (strpos($addition,'|checkPwd|') !== false){
		$isCheckUser += 10;
	}

	$reslutStr = '';
	$SaveImg = new SaveImg();
	$SaveImg->judProxy = false;
	$SaveImg->saveOss = $sysAdminArr['SA_upFileOss'];
	if ($isSaveContImg == 1){
		$content = $SaveImg->SaveContentImg($content, OT_ROOT . InfoImgDir, 0, '', InfoImgAdminDir);

		$newUpImgStr .= $SaveImg->imgStr;
		$reslutStr .= $SaveImg->errHtml;
		if (strlen($img) > 0 && strpos($SaveImg->oldImgStr, $img) !== false){
			$remOldImgArr	= explode('|',$SaveImg->oldImgStr);
			$remImgArr		= explode('|',$SaveImg->imgStr);
			$remImgCount	= count($remImgArr);
			for ($n=1; $n<$remImgCount; $n++){
				if ($img == $remOldImgArr[$n]){ $img = $remImgArr[$n]; break; }
			}
		}
	}
	$imgMode = Info::ImgMode($img);
	if ($isSaveImg == 1 && $imgMode == 2){	// 0无，1本地，2远程，3云存储
		$newImgExt = File::GetExt($img);	// 文件类型
		if (strlen($newImgExt)>8){ $newImgExt = 'jpg'; }
		
		// 判断保存文件不能为以下文件类型
		if (strpos('**|asp|asa|aspx|cer|cdx|exe|rar|zip|bat|','|'. $newImgExt .'|') === false){
			if (empty($sysImagesArr)){ $sysImagesArr = Cache::PhpFile('sysImages'); }
			$saveDirPath = Info::DateTimeDir($sysImagesArr['SI_isDir']);

			$newFileDir = 'coll/'. $saveDirPath;
				if ($SaveImg->CreateDir(OT_ROOT . InfoImgDir . $newFileDir)==false){
					$newFileDir = 'coll/';
				}
			$newFileName = $newFileDir .'OT'. File::GetNewName($newImgExt);
			// 执行保存操作 return array('res'=>false, 'size'=>图片大小, 'oss'=>'来源', 'url'=>'oss网址', 'note'=>'说明描述');
			$srfArr = $SaveImg->SaveRemoteFile(InfoImgAdminDir . $newFileName, $img, $newFileName, 0);
			if ($srfArr['res']){
				if (strlen($srfArr['url']) > 3){
					$img = $srfArr['url'];
				}else{
					$img = $newFileName;
				}
			}else{
				$reslutStr .= '<div style="color:red;font-weight:bold;">缩略图/图片 保存到本地失败（'. $srfArr['note'] .'）</div>';
			}
		}
	}

	$beforeURL = GetUrl::CurrDir(1);
	$imgUrl = $beforeURL . InfoImgDir;
	$content = str_replace($imgUrl,InfoImgAdminDir,$content);
	$encContent = str_replace($imgUrl,InfoImgAdminDir,$encContent);

	$conUeImgArr = $SaveImg->GetImgUrlArr($content,'');
	$conUeImgStr = '|';
	if (is_array($conUeImgArr)){
		foreach ($conUeImgArr as $ueImgUrl){
			if (strpos($ueImgUrl,InfoImgAdminDir .'ueditor/') !== false){
				$conUeImgStr .= str_replace(InfoImgAdminDir,'',$ueImgUrl) .'|';
			}
		}
		$newUpImgStr .= $conUeImgStr;
	}

	if (strlen($newUpImgStr) > 10 && $img == ''){
		$imgArr = explode('|',$newUpImgStr);
		foreach ($imgArr as $imgName){
			if ($imgName != '' && strpos('|.gif|.jpg|jpeg|.bmp|.png|',substr($imgName,-4)) !== false){
				$img = $imgName;
				break;
			}
		}
		if (Info::ImgMode($img) == 1 && strpos($infoSysArr['IS_addition'],'|contentThumb|') !== false){
			$thumbImg = Info::ImgThumbPath($img);
			$thumbPath = OT_ROOT . InfoImgDir . $thumbImg;
			if ( file_exists($thumbPath) ){
				$img = $thumbImg;
			}
		}
	}
	$pageCount = Content::CalcPageNum($content,$pageNum);
	$imgNumArr = Content::CalcImgNum($content);
	$fileNumArr = Info::CalcFileNum($fileStr);

	if (strlen($username) > 0){
		$urow = $DB->GetRow('select UE_ID,UE_username from '. OT_dbPref .'users where UE_username='. $DB->ForStr($username));
		if ($urow){
			$userID		= $urow['UE_ID'];
			$username	= $urow['UE_username'];
		}else{
			$username	= '';
		}
	}

	$record=array();
	$record['IF_userID']		= $userID;
	$record['IF_username']		= $username;
	$record['IF_revTime']		= TimeDate::Get();
	$record['IF_time']			= $themeTime;
	$record['IF_isOri']			= $isOri;
	$record['IF_theme']			= $theme;
	$record['IF_themeMd5']		= $themeMd5;
	$record['IF_template']		= $template;
	$record['IF_templateWap']	= $templateWap;
	$record['IF_source']		= $source;
	$record['IF_writer']		= $writer;
	$record['IF_typeStr']		= $typeStr;
	$record['IF_type1ID']		= $type1ID;
	$record['IF_type2ID']		= $type2ID;
	$record['IF_type3ID']		= $type3ID;
	$record['IF_URL']			= $webURL;
	$record['IF_isEncUrl']		= $isEncUrl;
	$record['IF_tabID']			= $tabID;
	if ($tabID == 0){
		$record['IF_content']	= $content;
	}else{
		$record['IF_content']	= '';
	}
	$record['IF_upImgStr']		= $newUpImgStr;
	$record['IF_themeKey']		= $themeKey;
	$record['IF_contentKey']	= $contentKey;
	$record['IF_pageNum']		= $pageNum;
	$record['IF_pageCount']		= $pageCount;
	$record['IF_fileName']		= $fileName;
	$record['IF_file']			= $file;
	$record['IF_fileStr']		= $fileStr;
	$record['IF_isRenameFile']	= $isRenameFile;
	$record['IF_isAudit']		= $isAudit;
	$record['IF_isNew']			= $isNew;
	$record['IF_isHomeThumb']	= $isHomeThumb;
	$record['IF_isThumb']		= $isThumb;
	$record['IF_isImg']			= $isImg;
	$record['IF_isFlash']		= $isFlash;
	$record['IF_isMarquee']		= $isMarquee;
	$record['IF_isRecom']		= $isRecom;
	$record['IF_isTop']			= $isTop;
	$record['IF_imgMode']		= Info::ImgMode($img);
	$record['IF_img']			= $img;
	$record['IF_voteMode']		= $voteMode;
	$record['IF_voteStr']		= $voteStr;
	$record['IF_isMarkNews']	= $isMarkNews;
	$record['IF_isReply']		= $isReply;
	$record['IF_topAddiID']		= $topAddiID;
	$record['IF_addiID']		= $addiID;
	$record['IF_readNum']		= $readNum;
	$record['IF_state']			= $state;
	$record['IF_wapState']		= $wapState;
	$record['IF_isCheckUser']	= $isCheckUser;
	$record['IF_freeGroupList']	= $freeGroupList;
	$record['IF_userGroupList']	= $userGroupList;
	$record['IF_userLevel']		= $userLevel;
	$record['IF_score1']		= $score1;
	$record['IF_score2']		= $score2;
	$record['IF_score3']		= $score3;
	$record['IF_cutScore1']		= $cutScore1;
	$record['IF_cutScore2']		= $cutScore2;
	$record['IF_cutScore3']		= $cutScore3;
	$record['IF_addition']		= $addition;
	$record['IF_auditNote']		= $auditNote;
	$record['IF_prevNewsId']	= $prevNewsId;
	$record['IF_nextNewsId']	= $nextNewsId;
	$record['IF_imgNum']		= $imgNumArr['total'];
	$record['IF_imgHttpNum']	= $imgNumArr['httpNum'];
	$record['IF_imgOssNum']		= $imgNumArr['ossNum'];
	$record['IF_imgLocalNum']	= $imgNumArr['localNum'];
	$record['IF_fileNum']		= $fileNumArr['total'];
	$record['IF_fileHttpNum']	= $fileNumArr['httpNum'];
	$record['IF_fileOssNum']	= $fileNumArr['ossNum'];
	$record['IF_fileLocalNum']	= $fileNumArr['localNum'];
	$record['IF_videoID']		= $videoID;
	$record['IF_payUserMul']	= $payUserMul;
	$record['IF_field1']		= $field1;
	$record['IF_field2']		= $field2;
	$record['IF_field3']		= $field3;
	$record['IF_mediaPcW']		= $mediaPcW;
	$record['IF_mediaPcH']		= $mediaPcH;
	$record['IF_mediaWapW']		= $mediaWapW;
	$record['IF_mediaWapH']		= $mediaWapH;
	if ($themeKeyIdEmpty == 1){
		$record['IF_themeKeyIdStr']	= '';
	}
	if (AppBase::Jud()){
		$record['IF_themeStyle']	= $themeStyle;
		$record['IF_isTitle']		= $isTitle;
		$record['IF_titleAddi']		= $titleAddi;
		$record['IF_isUserFile']	= $isUserFile;
	}
	if (AppMapBaidu::Jud()){
		$record['IF_isSitemap']		= $isSitemap;
		$record['IF_isXiongzhang']	= $isXiongzhang;
	}
	if (AppNewsEnc::Jud()){
		$record['IF_isEnc']			= $isEnc;
		$record['IF_encContent']	= $encContent;
	}
	if (AppVideo::Jud()){
		$record['IF_mediaFile']		= $mediaFile;
		$record['IF_mediaEvent']	= $mediaEvent;
	}
	if (AppTopic::Jud()){
		$record['IF_topicList']		= $topicList;
	}
	if (AppResBaidu::Jud()){
		$record['IF_resBaidu']		= $resBaidu;
	}
	if (AppRes360::Jud()){
		$record['IF_res360']		= $res360;
	}
	if (AppResSogou::Jud()){
		$record['IF_resSogou']		= $resSogou;
	}
	if (AppResShenma::Jud()){
		$record['IF_resShenma']		= $resShenma;
	}
	if (AppResToutiao::Jud()){
		$record['IF_resToutiao']	= $resToutiao;
	}
	if (AppResBing::Jud()){
		$record['IF_resBing']		= $resBing;
	}
	if (AppMoneyQuick::Jud()){
		$record['IF_cutQuickMoney']	= $cutQuickMoney;
	}
	if (AppNewsPwd::Jud()){
		$record['IF_pwdAnswer']		= $pwdAnswer;
		$record['IF_pwdImg']		= $pwdImg;
		$record['IF_pwdNote']		= $pwdNote;
	}

	$fileAddArr = $fileCutArr = $userSqlArr = array();
	$IF_upImgStr = '';
	$addrec=$DB->query('select * from '. OT_dbPref .'info where IF_ID='. $dataID);
	if (! $row = $addrec->fetch()){
		$alertMode = '新增';

		$record['IF_type']		=  $dataType;
		$record['IF_adminID']	=  $MB->mUserID;

		$judRes = $DB->InsertParam('info',$record);

		$fileAddArr[] = $file;
		$fileAddArr[] = $img;
	}else{
		$alertMode = '修改';
		$IF_upImgStr = $row['IF_upImgStr'];

		if ($revIDJud == 1 && $revID > 0){ $record['IF_ID'] = $revID; }

		if ($row['IF_userID'] > 0){
			if ($row['IF_isAudit'] != $isAudit){
				$newsAddScoreArr = Users::ScoreArr('newsAdd');
				if ($isAudit == 1 && $row['IF_isGetScore'] == 0){
					if ($newsAddScoreArr['US_score1'] < 0 || $newsAddScoreArr['US_score2'] < 0 || $newsAddScoreArr['US_score3'] < 0){
						$urs = $DB->GetRow('select UE_score1,UE_score2,UE_score3 from '. OT_dbPref .'users where UE_ID='. $row['IF_userID']);
						if ($urs){
							$uAlertStr = '';
							if ($urs['UE_score1'] + $newsAddScoreArr['US_score1'] < 0){ $uAlertStr .= $userSysArr['US_score1Name'] .'：'. $urs['UE_score1'] .'，不足以扣除 '. abs($newsAddScoreArr['US_score1']); }
							if ($urs['UE_score2'] + $newsAddScoreArr['US_score2'] < 0){ $uAlertStr .= $userSysArr['US_score2Name'] .'：'. $urs['UE_score2'] .'，不足以扣除 '. abs($newsAddScoreArr['US_score2']); }
							if ($urs['UE_score3'] + $newsAddScoreArr['US_score3'] < 0){ $uAlertStr .= $userSysArr['US_score3Name'] .'：'. $urs['UE_score3'] .'，不足以扣除 '. abs($newsAddScoreArr['US_score3']); }
							if (strlen($uAlertStr) > 0){
								JS::AlertBackEnd('付费投稿积分不足，禁止审核通过.\n\n'. $uAlertStr);
							}
						}
					}
					$record['IF_isGetScore']	= 1;
					$record['IF_getScore1']		= $newsAddScoreArr['US_score1'];
					$record['IF_getScore2']		= $newsAddScoreArr['US_score2'];
					$record['IF_getScore3']		= $newsAddScoreArr['US_score3'];
					$userSqlArr[] = Users::UpdateScore($row['IF_userID'], '+', $newsAddScoreArr['US_score1'], $newsAddScoreArr['US_score2'], $newsAddScoreArr['US_score3'], array(), 'get');

					if (AppUserScore::IsAdd($newsAddScoreArr['US_score1'], $newsAddScoreArr['US_score2'], $newsAddScoreArr['US_score3'])){
						$uexe = $DB->query('select UE_username,UE_score1,UE_score2,UE_score3 from '. OT_dbPref .'users where UE_ID='. $row['IF_userID']);
						if ($urow = $uexe->fetch()){
							$scoreArr = array();
							$scoreArr['UM_userID']		= $row['IF_userID'];
							$scoreArr['UM_username']	= $urow['UE_username'];
							$scoreArr['UM_type']		= 'audit1';
							$scoreArr['UM_dataID']		= $dataID;
							$scoreArr['UM_typeStr']		= $row['IF_typeStr'];
							$scoreArr['UM_type1ID']		= $row['IF_type1ID'];
							$scoreArr['UM_type2ID']		= $row['IF_type2ID'];
							$scoreArr['UM_type3ID']		= $row['IF_type3ID'];
							$scoreArr['UM_score1']		= $newsAddScoreArr['US_score1'];
							$scoreArr['UM_score2']		= $newsAddScoreArr['US_score2'];
							$scoreArr['UM_score3']		= $newsAddScoreArr['US_score3'];
							$scoreArr['UM_remScore1']	= $urow['UE_score1']+$newsAddScoreArr['US_score1'];
							$scoreArr['UM_remScore2']	= $urow['UE_score2']+$newsAddScoreArr['US_score2'];
							$scoreArr['UM_remScore3']	= $urow['UE_score3']+$newsAddScoreArr['US_score3'];
							$scoreArr['UM_note']		= '文章审核通过['. Info::InfoTypeCN($row['IF_type1ID'], $row['IF_type2ID'], $row['IF_type3ID']) .']《'. $theme .'》';
							$userSqlArr[] = AppUserScore::AddData($scoreArr,'get');
						}
						unset($uexe);
					}

				}elseif (($isAudit==0 || $isAudit==2) && $row['IF_isGetScore']==1){
					$record['IF_isGetScore']	= 0;
					$record['IF_getScore1']		= 0;
					$record['IF_getScore2']		= 0;
					$record['IF_getScore3']		= 0;
					$userSqlArr[] = Users::UpdateScore($row['IF_userID'], '-', $row['IF_getScore1'], $row['IF_getScore2'], $row['IF_getScore3'], array(), 'get');

					if (AppUserScore::IsAdd($row['IF_getScore1'], $row['IF_getScore2'], $row['IF_getScore3'])){
						$uexe = $DB->query('select UE_username,UE_score1,UE_score2,UE_score3 from '. OT_dbPref .'users where UE_ID='. $row['IF_userID']);
						if ($urow = $uexe->fetch()){
							$scoreArr = array();
							$scoreArr['UM_userID']		= $row['IF_userID'];
							$scoreArr['UM_username']	= $urow['UE_username'];
							$scoreArr['UM_type']		= 'audit0';
							$scoreArr['UM_dataID']		= $dataID;
							$scoreArr['UM_typeStr']		= $row['IF_typeStr'];
							$scoreArr['UM_type1ID']		= $row['IF_type1ID'];
							$scoreArr['UM_type2ID']		= $row['IF_type2ID'];
							$scoreArr['UM_type3ID']		= $row['IF_type3ID'];
							$scoreArr['UM_score1']		= $row['IF_getScore1']*(-1);
							$scoreArr['UM_score2']		= $row['IF_getScore2']*(-1);
							$scoreArr['UM_score3']		= $row['IF_getScore3']*(-1);
							$scoreArr['UM_remScore1']	= $urow['UE_score1']-$newsAddScoreArr['US_score1'];
							$scoreArr['UM_remScore2']	= $urow['UE_score2']-$newsAddScoreArr['US_score2'];
							$scoreArr['UM_remScore3']	= $urow['UE_score3']-$newsAddScoreArr['US_score3'];
							$scoreArr['UM_note']		= '文章审核不通过回收积分['. Info::InfoTypeCN($row['IF_type1ID'], $row['IF_type2ID'], $row['IF_type3ID']) .']《'. $theme .'》';
							$userSqlArr[] = AppUserScore::AddData($scoreArr,'get');
						}
						unset($uexe);
					}

				}
			}
		}
		$judRes = $DB->UpdateParam('info',$record,'IF_ID='. $dataID);

		if ($row['IF_file'] != $file){
			$fileAddArr[] = $file;
			$fileCutArr[] = $row['IF_file'];
		}
		if ($row['IF_img'] != $img){
			$fileAddArr[] = $img;
			$fileCutArr[] = $row['IF_img'];
		}
	}

	if ($judRes){
		$alertRes = '成功';
		if ($dataID == 0){ $dataID = $DB->GetOne('select max(IF_ID) from '. OT_dbPref .'info'); }
		if ($revIDJud == 0 || $revID == 0){ $revID = $dataID; }

		if ($tabID > 0){
			if ($alertMode == '新增'){
				$DB->InsertParam('infoContent'. $tabID, array('IC_ID'=>$dataID, 'IC_content'=>$content));
			}else{
				if ($oldTabID == $tabID){
					$chkRow = $DB->GetRow('select IC_ID from '. OT_dbPref .'infoContent'. $tabID .' where IC_ID='. $dataID);
					if ($chkRow){
						$DB->UpdateParam('infoContent'. $tabID, array('IC_ID'=>$revID,'IC_content'=>$content), 'IC_ID='. $dataID);
					}else{
						$DB->InsertParam('infoContent'. $tabID, array('IC_ID'=>$revID, 'IC_content'=>$content));
					}
				}else{
					$DB->InsertParam('infoContent'. $tabID, array('IC_ID'=>$revID, 'IC_content'=>$content));
				}
			}
		}
		if ($alertMode == '修改' && $oldTabID > 0 && $oldTabID != $tabID){
			$DB->Delete('infoContent'. $oldTabID, 'IC_ID='. $dataID);
		}

		// $htmlDir = '';
		// $IF_infoTypeDir = $row['IF_infoTypeDir'];
		// $IF_datetimeDir = $row['IF_datetimeDir'];
		$dataArr = array();
		if ($alertMode == '新增' && AppAutoImg::Jud()){
			// 打钩【如为空，自动配图】选项
			if ($isAutoImg == 1 && strlen($img) == 0){
				$img = '';
				$isSave = AppAutoImg::MakeImg($dataID, $theme, $DB->GetOne('select IT_theme from '. OT_dbPref .'infoType where IT_ID='. $typeCurrID), 'save');
				if ($isSave){
					$img = AppAutoImg::ImgRelPath($dataID, $theme);
				}
				if (strlen($img) > 0){
					$addiArr = Info::AdditionArr($infoSysArr['IS_addition']);
					$dataArr['IF_img']			= $img;
					$dataArr['IF_imgMode']		= 10;
					$dataArr['IF_isHomeThumb']	= $addiArr['autoImg_homeThumb'];
					$dataArr['IF_isThumb']		= 1;
					$dataArr['IF_isImg']		= $addiArr['autoImg_img'];
					$dataArr['IF_isFlash']		= $addiArr['autoImg_flash'];
				}
			}
			// 自动配图图片名改为含文章ID信息
			if (substr($img,0,14) == 'autoImg/info0_'){
				$oldPath = OT_ROOT . InfoImgDir . $img;
				$newImg = AppAutoImg::ImgRelPath($dataID, $theme);
				$newPath = OT_ROOT . InfoImgDir . $newImg;
				$judRes = File::Copy($oldPath, $newPath);
					if ($judRes){
						File::Del($oldPath);
						$dataArr['IF_img']	= $newImg;
					}
			}
		}
		if (($alertMode=='新增' || $isChangeInfoTypeDir==1) && $systemArr['SYS_htmlInfoTypeDir']==1){
			// 设置栏目静态目录名
			if ($typeStr=='announ'){
				$IF_infoTypeDir = 'announ/';
			}else{
				$IF_infoTypeDir = $DB->GetOne('select IT_htmlName from '. OT_dbPref .'infoType where IT_ID='. $typeCurrID) .'/';
			}
			$dataArr['IF_infoTypeDir']		= $IF_infoTypeDir;
		}
		if ($alertMode=='新增' || $isChangeDatetimeDir>0){
			// 设置时间静态目录名
			$IF_datetimeDir = Info::DatetimeDirName($themeTime,-1) .'/';
			$dataArr['IF_datetimeDir']		= $IF_datetimeDir;
		}
		if (count($dataArr)>0){
			$DB->UpdateParam('info',$dataArr,'IF_ID='. $revID);
		}
		// if ($systemArr['SYS_htmlInfoTypeDir']==1 && strlen($IF_infoTypeDir)>1){ $htmlDir .= $IF_infoTypeDir; }
		// if ($systemArr['SYS_htmlDatetimeDir']>0 && strlen($IF_datetimeDir)>1){ $htmlDir .= $IF_datetimeDir; }
		ServerFile::UseAddMore($fileAddArr);
		ServerFile::UseCutMore($fileCutArr);
		ServerFile::Editor($IF_upImgStr,$upImgStr,$content);
		$runMoreArr = $DB->RunMore($userSqlArr);
		echo($runMoreArr['errSqlStr']);
	}else{
		$alertRes = '失败';
	}
	unset($addrec);

	Adm::AddLog(array(
		'theme'	=> $theme,
		'note'	=> '【'. $dataTypeCN .'】'. $alertMode . $alertRes .'！',
		));

	$makeStr = '';
	$makeSec = 1;
	$makeNum = 0;
	if ($dataID != $revID && $revID > 0){ $dataID = $revID; }
	if ($systemArr['SYS_newsShowUrlMode'] == 'html-2.x' && $isAudit == 1 && ($state == 1 || $wapState == 1)){
		if ($dataID==0){ $dataID = $DB->GetOne('select max(IF_ID) from '. OT_dbPref .'info'); }

		$isMakeHtml = true;
		/*
		if InStr(addition,'|makeHtml|')>0 Then
			isMakeHtml=True
			For i=1 To pageCount
				If i>1 Then htmlFilePart = '_'& i Else htmlFilePart = ''
				infoFileStr = CD_GetCode(beforeURL &'news/?'. $dataID . htmlFilePart &'.html&rnd='& Timer())
				If SYS_diyInfoTypeDir=1 And SYS_htmlInfoTypeDir=1 Then
					htmlMakeUrl = htmlDir . $dataID . htmlFilePart &'.html'
				else
					htmlMakeUrl = SYS_newsShowFileName &'/'& htmlDir . $dataID . htmlFilePart &'.html'
				end if
				If InStr(infoFileStr,'webTypeName')>=1 Then
					judFileRes = CD_WriteFile(infoFileStr & Chr(13) &'<!-- Html For '& Now() &' -->',Server.MapPath('../'& htmlMakeUrl))
					If judFileRes=True Then
						makeStr = makeStr &'<br />'& htmlMakeUrl &' ...<span style='color:green;'>生成成功</span>'
					Else
						isMakeHtml=False
						makeStr = makeStr &'<br />'& htmlMakeUrl &' ...<span class='font2_2'>生成失败(写入文件失败)</span>'
					End If

				Else
					isMakeHtml=False
					makeStr = makeStr &'<br />'& htmlMakeUrl &' ...<span class='font2_2'>生成失败</span>'
				End If
			Next
		End If
		*/
		if ($isMakeHtml && strpos($addition,'|noMakeHtml|') === false){
			if ($state == 1){
				$makeSec += 2;
				$makeNum ++;
				$makeStr .= '
				<br />生成电脑版静态页：<iframe id="infoIframe'. $dataID .'" name="infoIframe'. $dataID .'" frameborder="0" allowTransparency="true" scrolling="no" style="width:220px;height:20px;" src="makeHtml_deal.php?mudi=newsOne&htmlEachSec=1&htmlEachNum=99&startNum=0&dataID='. $dataID .'&rnd='. time() .'"></iframe>
				';
			}
			if ($wapState == 1 && AppWap::Jud()){
				$makeSec += 2;
				$makeNum ++;
				$makeStr .= '
				<br />生成手机版静态页：<iframe id="infoIframeWap'. $dataID .'" name="infoIframeWap'. $dataID .'" frameborder="0" allowTransparency="true" scrolling="no" style="width:220px;height:20px;" src="makeHtml_deal.php?mudi=newsOne&mode=wap&htmlEachSec=1&htmlEachNum=99&startNum=0&dataID='. $dataID .'&rnd='. time() .'"></iframe>
				';
			}
		}
	}

//	JS::AlertHref(''. $alertMode .'成功',$backURL);
	if ($alertMode == '新增'){
		$alertStr = '新增'. $dataTypeCN;
		if ($dataID==0){ $dataID = $DB->GetOne('select max(IF_ID) from '. OT_dbPref .'info'); }
		$backURL = 'info.php?mudi=add&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'&dataMode='. $dataMode .'&dataModeStr='. $dataModeStr .'&dataID='. $dataID .'';
	}else{
		$alertStr = $dataTypeCN .'管理';
	}

	$pageCountStr='';
	if ($pageCount > 20){
		$pageCountStr = '，<span style="color:red;">当前内容分页为'. $pageCount .'页偏大了，建议重新修改分页</span>';
		$backURL = 'info.php?mudi=rev&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'&dataMode='. $dataMode .'&dataModeStr='. $dataModeStr .'&dataID='. $dataID .'';
	}

	/* 
	if ($bdPing == 0){
		if ($dataID==0){ $dataID = $DB->GetOne('select max(IF_ID) from '. OT_dbPref .'info'); }
		$getexe=$DB->query('select IF_ID,IF_infoTypeDir,IF_datetimeDir from '. OT_dbPref .'info where IF_ID='. $dataID);
		if ($row = $getexe->fetch()){
			$pingStr=''.
			'<?xml version="1.0" encoding="UTF-8"?>'.
			'<methodCall>'.
			'	<methodName>weblogUpdates.extendedPing</methodName>'.
			'	<params>'.
			'		<param>'.
			'			<value><string>'. $systemArr['SYS_title'] .'</string></value>'.
			'		</param>'.
			'		<param>'.
			'			<value><string>'. $beforeURL .'</string></value>'.
			'		</param>'.
			'		<param>'.
			'			<value><string>'. $beforeURL . Url::NewsID($row['IF_infoTypeDir'],$row['IF_datetimeDir'],$row['IF_ID'],0) .'</string></value>'.
			'		</param>'.
			'		<param>'.
			'			<value><string>'. $beforeURL .'rss.php?maxNum=100</string></value>'.
			'		</param>'.
			'	</params>'.
			'</methodCall>';
		}
		unset($getexe);

		$retStr = ReqUrl::UseAuto2($sysAdminArr['SA_getUrlMode'], 'POST', 'http://ping.baidu.com/ping/RPC2', 'UTF-8', $pingStr, 'note');

		if (strpos($retStr,'<int>0</int>') !== false){
			$reslutStr .= '<span style="color:green;font-weight:bold;">百度Ping成功。</span>';
			$DB->query('update '. OT_dbPref .'info set IF_bdPing=1 where IF_ID='. $dataID);
		}else{
			$reslutStr .= '<span style="color:red;font-weight:bold;">百度Ping失败。</span>';
		}
	} */
	if ($isSitemap == 0 && AppMapBaidu::Jud()){
		if (strlen($sysAdminArr['SA_bdSitemapUrl']) < 7){
			$reslutStr .= '<span style="color:red;font-weight:bold;">百度主动推送接口地址未填，无法进行主动推送（请到 辅助管理→生成sitemap 设置）。</span>';
		}else{
			if ($dataID == 0){ $dataID = $DB->GetOne('select max(IF_ID) from '. OT_dbPref .'info'); }
			$row = $DB->GetRow('select IF_ID,IF_infoTypeDir,IF_datetimeDir from '. OT_dbPref .'info where IF_ID='. $dataID);

			$newsStr = $beforeURL . Url::NewsID($row['IF_infoTypeDir'],$row['IF_datetimeDir'],$row['IF_ID'],0);
			$result = PostUrl($sysAdminArr['SA_bdSitemapUrl'], $newsStr);
			// $result = ReqUrl::UseAuto2($sysAdminArr['SA_getUrlMode'], 'POST', $sysAdminArr['SA_bdSitemapUrl'], 'UTF-8', $newsStr, 'note');

			if (strpos($result,'"error"') !== false){
				$msgStr = Str::GetMark($result,'"message":"','"');
				if ($msgStr == 'over quota'){ $msgStr .= '（超出配额，请明天再试）'; }
				$reslutStr .= '<span style="color:red;font-weight:bold;">百度主动推送失败（错误码：'. Str::GetMark($result,'"error":',',') .'，描述：'. $msgStr .'）。</span>';
			}else{
				$successNum = OT::ToInt(Str::GetMark($result,'"success":',','),-1);
				$remainNum = OT::ToInt(Str::GetMark($result,'"remain":',','),-1);
				if ($successNum == -1 && $remainNum == -1){
					$reslutStr .= '<span style="color:red;font-weight:bold;">百度主动推送失败（数据反馈异常，请重新推送）。</span>';
				}else{
					$reslutStr .= '<span style="color:green;font-weight:bold;">百度主动推送成功（今日还能推送条数：'. $remainNum .'）。</span>';
					$DB->query('update '. OT_dbPref .'info set IF_isSitemap=1 where IF_ID='. $dataID);
				}
			}
		}
	}

	$skin->WebCommon();

	echo('
	<br /><br />
	<meta http-equiv="Content-Type" content="text/html; charset='. OT_Charset .'">
	<table align="center"><tr><td style="font-size:14px;">
	'. $reslutStr .'<br /><br />
	操作'. $alertRes . $pageCountStr .'，<span id="number" style="color:red;">'. ($makeSec+1) .'</span>秒后返回【'. $alertStr .'】'. $makeStr .'<br /><br />
	<a href="info.php?mudi=add&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'&dataMode='. $dataMode .'&dataModeStr='. $dataModeStr .'&dataID='. $dataID .'">继续[新增'. $dataTypeCN .']</a>&ensp;&ensp;&ensp;&ensp;
	<a href="info.php?mudi=manage&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'&dataMode='. $dataMode .'&dataModeStr='. $dataModeStr .'">回到['. $dataTypeCN .'管理]</a>
	</td></tr></table>
	
	<script language="javascript" type="text/javascript">
	var sec = '. $makeSec .'; num = '. $makeNum .'; calcSkipTime=null;
	function SkipNum(){
		document.getElementById("number").innerHTML = sec;
		if (sec<=0 || num<=0){ document.location.href="'. $backURL .'";clearInterval(calcSkipTime); }
		sec --;
	}
	function SetSkipNum(){
		calcSkipTime = setInterval("SkipNum()",1000);
	}
	SetSkipNum();
	WindowHeight(0);
	</script>
	');

}



// 删除
function del(){
	global $DB,$MB,$mudi,$menuFileID,$menuTreeID,$dataType,$dataTypeCN,$systemArr;

	$dataID	= OT::GetInt2( OT::ParaArr('id') );
	$theme	= OT::GetStr('theme');

	$delrec=$DB->query('select IF_ID,IF_type1ID,IF_type2ID,IF_adminID,IF_upImgStr,IF_imgMode,IF_img,IF_fileStr,IF_pageCount,IF_userID,IF_infoTypeDir,IF_datetimeDir,IF_tabID,IF_content from '. OT_dbPref .'info where IF_ID='. $dataID);
		if (! $row = $delrec->fetch()){
			JS::AlertEnd('不存在该记录');
		}
		// 后台增加栏目文章权限设置 插件 检测是否可以删除
		AppAdminRightNews::InfoRevCheck($MB->mRightStr, $row['IF_type1ID'], $row['IF_type2ID'], $row['IF_adminID'], $MB->mUserID, 'alert', '删除');

	$retArr = Info::DelData($dataID, $row);
		if ($retArr['res']){
			$alertRes = '成功';
		}else{
			$alertRes = '失败';
		}
	$alertStr = $retArr['note'];

	Adm::AddLog(array(
		'theme'	=> $theme,
		'note'	=> '【'. $dataTypeCN .'】删除'. $alertRes .'！',
		));

	JS::Diy('
	parent.$id("data'. $dataID .'").style.display="none";
	parent.$id("dealAlertStr").innerHTML="<div>删除“'. str_replace(array('\\','/','\'','"'), array('\\\\','\\/','\\\'','\\"'), $theme) .'”'. $alertRes .'！</div>'. $alertStr .'";
	');
}



// 批量删除
function MoreDel(){
	global $DB,$MB,$mudi,$menuFileID,$menuTreeID,$systemArr;

	$backURL	= OT::PostStr('backURL');
	$dataType	= OT::PostStr('dataType');
	$dataTypeCN	= OT::PostStr('dataTypeCN');
	$selDataID	= OT::Post('selDataID');

	$selCount = OT::NewCount($selDataID);
	if ($selCount <= 0){
		JS::AlertBackEnd('请先选择要删除的记录.');
	}

	$whereStr = '';
	for ($i=0; $i<$selCount; $i++){
		$whereStr .= ','. intval($selDataID[$i]);
	}
	if ($whereStr == ''){
		JS::AlertBackEnd('请先选择要删除的记录.');
	}


	$fileCutStr = '';
	$dataNum = $delNum = 0;
	$delrec=$DB->query('select IF_ID,IF_type1ID,IF_type2ID,IF_adminID,IF_upImgStr,IF_imgMode,IF_img,IF_fileStr,IF_pageCount,IF_userID,IF_infoTypeDir,IF_datetimeDir,IF_tabID,IF_content from '. OT_dbPref .'info where IF_ID in (0'. $whereStr .')');
	while ($row = $delrec->fetch()){
		$dataNum ++;
		// 后台增加栏目文章权限设置 插件 检测是否可以删除
		AppAdminRightNews::InfoRevCheck($MB->mRightStr, $row['IF_type1ID'], $row['IF_type2ID'], $row['IF_adminID'], $MB->mUserID, 'alertBack', '删除');

		$retArr = Info::DelData($row['IF_ID'], $row);
			if ($retArr['res']){
				$delNum ++;
			}
	}
	unset($delrec);

	Adm::AddLog(array(
		'note'		=> '【'. $dataTypeCN .'】批量删除(共'. $dataNum .'条，成功'. $delNum .'条)！',
		));

	JS::AlertHrefEnd('批量删除(共'. $dataNum .'条，成功'. $delNum .'条).',$backURL);
}



// 文章内容表 删除
function InfoContentDel(){
	global $DB,$mudi,$menuFileID,$menuTreeID,$dataType,$dataTypeCN;

	$dataID	= OT::GetInt2( OT::ParaArr('id') );
	$theme	= OT::GetStr('theme');
	$tabID	= OT::GetInt('tabID');
		if ($tabID <= 0){ JS::AlertEnd('内容表ID不能为空'); }

	$judRes = $DB->query('delete from '. OT_dbPref .'infoContent'. $tabID .' where IC_ID='. $dataID);
	if ($judRes == true){
		$alertRes = '成功';
	}else{
		$alertRes = '失败';
	}

	Adm::AddLog(array(
		'theme'	=> $theme,
		'note'	=> '【'. $dataTypeCN .'】删除'. $alertRes .'！',
		));
	
	JS::ParentHiddenEnd('data'. $dataID);
}



// 批量删除
function InfoContentMoreDel(){
	global $DB,$mudi,$menuFileID,$menuTreeID,$systemArr;

	$backURL	= OT::PostStr('backURL');
	$dataType	= OT::PostStr('dataType');
	$dataTypeCN	= OT::PostStr('dataTypeCN');
	$selDataID	= OT::Post('selDataID');
	$tabID		= OT::PostInt('tabID');
		if ($tabID <= 0){ JS::AlertBackEnd('内容表ID不能为空'); }

	$selCount = OT::NewCount($selDataID);
	if ($selCount <= 0){
		JS::AlertBackEnd('请先选择要删除的记录.');
	}

	$whereStr = '';
	for ($i=0; $i<$selCount; $i++){
		$whereStr .= ','. intval($selDataID[$i]);
	}
	if ($whereStr == ''){
		JS::AlertBackEnd('请先选择要删除的记录.');
	}

	$judRes = $DB->query('delete from '. OT_dbPref .'infoContent'. $tabID .' where IC_ID in (0'. $whereStr .')');

	Adm::AddLog(array(
		'note'		=> '【'. $dataTypeCN .'】批量删除完成！',
		));

	JS::AlertHrefEnd('批量删除完成.',$backURL);
}



// 栏目批量移动
function MoreMoveDeal(){
	global $DB,$mudi,$menuFileID,$menuTreeID,$dataType,$dataTypeCN,$systemArr;

	$backURL		= OT::PostStr('backURL');
	$dataType		= OT::PostStr('dataType');
	$dataTypeCN		= OT::PostStr('dataTypeCN');
	$moreMoveTo		= OT::PostRegExpStr('moreMoveTo','sql+,');
	$moreMoveToCN	= OT::PostRegExpStr('moreMoveToCN','sql');
	$selDataID		= OT::Post('selDataID');

	$selCount = OT::NewCount($selDataID);
	if ($selCount <= 0){
		JS::AlertBackEnd('请先选择要移动的记录.');
	}
	if ($moreMoveTo==''){
		JS::AlertBackEnd('请选择批量移动的栏目.');
	}

	$whereStr = '';
	for ($i=0; $i<$selCount; $i++){
		$whereStr .= ','. intval($selDataID[$i]);
	}
	if ($whereStr == ''){
		JS::AlertBackEnd('请先选择要移动的记录.');
	}

	$typeStr		= $moreMoveTo;
	$itArr = Info::InfoTypeArr($typeStr);
	$type1ID	= $itArr['type1ID'];
	$type2ID	= $itArr['type2ID'];
	$type3ID	= $itArr['type3ID'];
	// $typeCurrID	= $itArr['typeCurrID'];

	$judRes = $DB->query('update '. OT_dbPref .'info set IF_typeStr='. $DB->ForStr($moreMoveTo) .',IF_type1ID='. $type1ID .',IF_type2ID='. $type2ID .',IF_type3ID='. $type3ID .' where IF_ID in (0'. $whereStr .')');
	if ($judRes){
		$alertRes = '成功';
	}else{
		$alertRes = '失败';
	}

	Adm::AddLog(array(
		'note'		=> '【'. $dataTypeCN .'】栏目批量移动到['. $moreMoveToCN .']'. $alertRes .'！',
		));

	JS::AlertHref('栏目批量移动'. $alertRes .'.',$backURL);
}



// 附加内容批量移动
function MoreAddiDeal(){
	global $DB,$mudi,$menuFileID,$menuTreeID,$dataType,$dataTypeCN,$systemArr;

	$backURL		= OT::PostStr('backURL');
	$dataType		= OT::PostStr('dataType');
	$dataTypeCN		= OT::PostStr('dataTypeCN');
	$moreTxtSel		= OT::PostRegExpStr('moreTxtSel','sql');
	$selDataID		= OT::Post('selDataID');

	$selCount = OT::NewCount($selDataID);
	if ($selCount <= 0){
		JS::AlertBackEnd('请先选择要设置的记录.');
	}

	$whereStr = '';
	for ($i=0; $i<$selCount; $i++){
		$whereStr .= ','. intval($selDataID[$i]);
	}
	if ($whereStr == ''){
		JS::AlertBackEnd('请先选择要设置的记录.');
	}

	$record = array();
	if (in_array($moreTxtSel,array('topAddiID','addiID'))){
		$moreAddiTo		= OT::PostInt('moreAddiTo',-1);
		$moreAddiToCN	= OT::PostRegExpStr('moreAddiToCN','sql');
		if ($moreAddiTo < 0){
			JS::AlertBackEnd('请选择批量设置的栏目.');
		}
		$record['IF_'. $moreTxtSel] = $moreAddiTo;

		if ($moreTxtSel == 'topAddiID'){ $selName = '正文头附加内容'; }else{ $selName = '正文尾附加内容'; }
		$alertStr = $selName .' 批量设置为['. $moreAddiToCN .']';

	}elseif (in_array($moreTxtSel,array('freeGroup','userGroup'))){
		$moreAddiToCN	= OT::PostRegExpStr('moreAddiToCN','sql+[]');
		$userGroupList	= OT::Post('userGroupList');
			if (is_array($userGroupList)){ $userGroupList = implode(',',$userGroupList); }
			if ($userGroupList == '[empty]'){ $userGroupList = ''; }
		$record['IF_'. $moreTxtSel .'List'] = $userGroupList;
		if ($moreTxtSel == 'freeGroup'){ $selName = '免费阅读组'; }else{ $selName = '限制/付费阅读组'; }
		$alertStr = $selName .' 批量设置为【'. $moreAddiToCN .'】';

	}elseif (in_array($moreTxtSel,array('topic'))){
		$moreAddiToCN	= OT::PostRegExpStr('moreAddiToCN','sql+[]');
		$topicList	= OT::Post('topicList');
			if (is_array($topicList)){ $topicList = ','. implode(',',$topicList) .','; }
		$record['IF_topicList'] = $topicList;
		$selName = '专题';
		$alertStr = $selName .' 批量设置为【'. $moreAddiToCN .'】';

	}elseif (in_array($moreTxtSel,array('source','writer'))){
		$moreTxtVal		= OT::PostStr('moreTxtVal');
		$record['IF_'. $moreTxtSel] = $moreTxtVal;

		if ($moreTxtSel == 'source'){ $selName = '来源'; }else{ $selName = '作者'; }
		$alertStr = $selName .' 批量设置为['. $moreTxtVal .']';

	}elseif (in_array($moreTxtSel,array('readNum','score1','score2','score3','cutScore1','cutScore2','cutScore3','cutQuickMoney'))){
		if ($moreTxtSel == 'cutQuickMoney'){
			$moreTxtVal = OT::PostFloat('moreTxtVal');
		}else{
			$moreTxtVal = OT::PostInt('moreTxtVal');
		}
		$record['IF_'. $moreTxtSel] = $moreTxtVal;

		switch ($moreTxtSel){
			case 'readNum':		$selName = '阅读量';		break;
			case 'score1':		$selName = '限制阅读积分1';	break;
			case 'score2':		$selName = '限制阅读积分2';	break;
			case 'score3':		$selName = '限制阅读积分3';	break;
			case 'cutScore1':	$selName = '付费阅读积分1';	break;
			case 'cutScore2':	$selName = '付费阅读积分2';	break;
			case 'cutScore3':	$selName = '付费阅读积分3';	break;
			case 'cutQuickMoney':	$selName = '直接在线支付';	break;
		}
		$alertStr = $selName .' 批量设置为['. $moreTxtVal .']';

	}else{
		JS::AlertBackEnd('请选择批量设置的字段['. $moreTxtSel .'].');
	}

	$judRes = $DB->UpdateParam('info', $record, 'IF_ID in (0'. $whereStr .')');
		if ($judRes){
			$alertRes = '成功';
		}else{
			$alertRes = '失败';
		}

	Adm::AddLog(array(
		'note'		=> '【'. $dataTypeCN .'】'. $alertStr . $alertRes .'！',
		));

	JS::AlertHref($alertStr . $alertRes .'！', $backURL);
}



// 批量设置
function MoreSetDeal(){
	global $DB,$mudi,$menuFileID,$menuTreeID,$dataType,$dataTypeCN,$systemArr;

	$backURL		= OT::PostStr('backURL');
	$dataType		= OT::PostStr('dataType');
	$dataTypeCN		= OT::PostStr('dataTypeCN');
	$moreSetTo		= OT::PostRegExpStr('moreSetTo','sql');
	$moreSetToCN	= OT::PostRegExpStr('moreSetToCN','sql');
	$selDataID		= OT::Post('selDataID');

	$selCount = OT::NewCount($selDataID);
	if ($selCount <= 0){
		JS::AlertBackEnd('请先选择要设置的记录.');
	}
	if ($moreSetTo==''){
		JS::AlertBackEnd('请选择批量设置的操作.');
	}

	$whereStr = '';
	for ($i=0; $i<$selCount; $i++){
		$whereStr .= ','. intval($selDataID[$i]);
	}
	if ($whereStr == ''){
		JS::AlertBackEnd('请先选择要设置的记录.');
	}

	$addiJud = false;
	$addiMode = -1;
	$addiVal = '';
	switch ($moreSetTo){
		case 'audit1':		$dealStr = 'IF_isAudit=1';		break;
		case 'audit0':		$dealStr = 'IF_isAudit=0';		break;
		case 'new1':		$dealStr = 'IF_isNew=1';		break;
		case 'new0':		$dealStr = 'IF_isNew=0';		break;
		case 'homeThumb1':	$dealStr = 'IF_isHomeThumb=1';	break;
		case 'homeThumb0':	$dealStr = 'IF_isHomeThumb=0';	break;
		case 'thumb1':		$dealStr = 'IF_isThumb=1';		break;
		case 'thumb0':		$dealStr = 'IF_isThumb=0';		break;
		case 'img1':		$dealStr = 'IF_isImg=1';		break;
		case 'img0':		$dealStr = 'IF_isImg=0';		break;
		case 'flash1':		$dealStr = 'IF_isFlash=1';		break;
		case 'flash0':		$dealStr = 'IF_isFlash=0';		break;
		case 'marquee1':	$dealStr = 'IF_isMarquee=1';	break;
		case 'marquee0':	$dealStr = 'IF_isMarquee=0';	break;
		case 'recom1':		$dealStr = 'IF_isRecom=1';		break;
		case 'recom0':		$dealStr = 'IF_isRecom=0';		break;
		case 'top1':		$dealStr = 'IF_isTop=1';		break;
		case 'top0':		$dealStr = 'IF_isTop=0';		break;
		case 'ori1':		$dealStr = 'IF_isOri=1';		break;
		case 'ori0':		$dealStr = 'IF_isOri=0';		break;
		case 'vote0':		$dealStr = 'IF_voteMode=0';		break;
		case 'vote1':		$dealStr = 'IF_voteMode=1';		break;
		case 'vote2':		$dealStr = 'IF_voteMode=2';		break;
		case 'vote11':		$dealStr = 'IF_voteMode=11';	break;
		case 'markNews1':	$dealStr = 'IF_isMarkNews=1';	break;
		case 'markNews0':	$dealStr = 'IF_isMarkNews=0';	break;
		case 'userFile0':	$dealStr = 'IF_isUserFile=0';	break;
		case 'userFile1':	$dealStr = 'IF_isUserFile=1';	break;
		case 'userFile2':	$dealStr = 'IF_isUserFile=2';	break;
		case 'reply1':		$dealStr = 'IF_isReply=1';		break;
		case 'reply10':		$dealStr = 'IF_isReply=10';		break;
		case 'reply0':		$dealStr = 'IF_isReply=0';		break;
		case 'state1':		$dealStr = 'IF_state=1';		break;
		case 'state0':		$dealStr = 'IF_state=0';		break;
		case 'wapState1':	$dealStr = 'IF_wapState=1';		break;
		case 'wapState0':	$dealStr = 'IF_wapState=0';		break;
		case 'isEnc1':		$dealStr = 'IF_isEnc=1';		break;
		case 'isEnc0':		$dealStr = 'IF_isEnc=0';		break;
		case 'isSitemap0':	$dealStr = 'IF_isSitemap=0';	break;
		case 'isSitemap2':	$dealStr = 'IF_isSitemap=2';	break;
		case 'isSitemap1':	$dealStr = 'IF_isSitemap=1';	break;
		case 'isXiongzhang0':	$dealStr = 'IF_isXiongzhang=0';	break;
		case 'isXiongzhang2':	$dealStr = 'IF_isXiongzhang=2';	break;
		case 'isXiongzhang1':	$dealStr = 'IF_isXiongzhang=1';	break;
		// case 'bdPing0':		$dealStr = 'IF_bdPing=0';		break;
		// case 'bdPing2':		$dealStr = 'IF_bdPing=2';		break;
		// case 'bdPing1':		$dealStr = 'IF_bdPing=1';		break;
		case 'resBaidu0':	$dealStr = 'IF_resBaidu=0';		break;
		case 'resBaidu1':	$dealStr = 'IF_resBaidu=1';		break;
		case 'resBaidu2':	$dealStr = 'IF_resBaidu=2';		break;
		case 'resBaidu11':	$dealStr = 'IF_resBaidu=11';	break;
		case 'resBaidu12':	$dealStr = 'IF_resBaidu=12';	break;
		case 'res3600':		$dealStr = 'IF_res360=0';		break;
		case 'res3601':		$dealStr = 'IF_res360=1';		break;
		case 'res3602':		$dealStr = 'IF_res360=2';		break;
		case 'res36011':	$dealStr = 'IF_res360=11';		break;
		case 'res36012':	$dealStr = 'IF_res360=12';		break;
		case 'resSogou0':	$dealStr = 'IF_resSogou=0';		break;
		case 'resSogou1':	$dealStr = 'IF_resSogou=1';		break;
		case 'resSogou2':	$dealStr = 'IF_resSogou=2';		break;
		case 'resSogou11':	$dealStr = 'IF_resSogou=11';	break;
		case 'resSogou12':	$dealStr = 'IF_resSogou=12';	break;
		case 'resShenma0':	$dealStr = 'IF_resShenma=0';	break;
		case 'resShenma1':	$dealStr = 'IF_resShenma=1';	break;
		case 'resShenma2':	$dealStr = 'IF_resShenma=2';	break;
		case 'resShenma11':	$dealStr = 'IF_resShenma=11';	break;
		case 'resShenma12':	$dealStr = 'IF_resShenma=12';	break;
		case 'resToutiao0':	$dealStr = 'IF_resToutiao=0';	break;
		case 'resToutiao1':	$dealStr = 'IF_resToutiao=1';	break;
		case 'resToutiao2':	$dealStr = 'IF_resToutiao=2';	break;
		case 'resToutiao11':$dealStr = 'IF_resToutiao=11';	break;
		case 'resToutiao12':$dealStr = 'IF_resToutiao=12';	break;
		case 'resBing0':	$dealStr = 'IF_resBing=0';		break;
		case 'resBing1':	$dealStr = 'IF_resBing=1';		break;
		case 'resBing2':	$dealStr = 'IF_resBing=2';		break;
		case 'resBing11':	$dealStr = 'IF_resBing=11';		break;
		case 'resBing12':	$dealStr = 'IF_resBing=12';		break;
		case 'timeNew':		$dealStr = 'IF_time='. $DB->ForTime(TimeDate::Get());	break;
		case 'contentImg1':
			$addiJud = true;	$addiMode = 1;		$addiVal = '|contentImg|';
			break;
		case 'contentImg0':
			$addiJud = true;	$addiMode = 0;		$addiVal = '|contentImg|';
			break;
		case 'noMakeHtml1':
			$addiJud = true;	$addiMode = 1;		$addiVal = '|noMakeHtml|';
			break;
		case 'noMakeHtml0':
			$addiJud = true;	$addiMode = 0;		$addiVal = '|noMakeHtml|';
			break;
		case 'noInfoType1':
			$addiJud = true;	$addiMode = 1;		$addiVal = '|noInfoType|';
			break;
		case 'noInfoType0':
			$addiJud = true;	$addiMode = 0;		$addiVal = '|noInfoType|';
			break;
		case 'checkUser1':
			$addiJud = true;	$addiMode = 1;		$addiVal = '|checkUser|';
			break;
		case 'checkUser0':
			$addiJud = true;	$addiMode = 0;		$addiVal = '|checkUser|';
			break;
		case 'checkReply1':
			$addiJud = true;	$addiMode = 1;		$addiVal = '|checkReply|';
			break;
		case 'checkReply0':
			$addiJud = true;	$addiMode = 0;		$addiVal = '|checkReply|';
			break;
		case 'checkQuick1':
			$addiJud = true;	$addiMode = 1;		$addiVal = '|checkQuick|';
			break;
		case 'checkQuick0':
			$addiJud = true;	$addiMode = 0;		$addiVal = '|checkQuick|';
			break;
		case 'checkPwd1':
			$addiJud = true;	$addiMode = 1;		$addiVal = '|checkPwd|';
			break;
		case 'checkPwd0':
			$addiJud = true;	$addiMode = 0;		$addiVal = '|checkPwd|';
			break;
		case 'encFile1':
			$addiJud = true;	$addiMode = 1;		$addiVal = '|encFile|';
			break;
		case 'encFile0':
			$addiJud = true;	$addiMode = 0;		$addiVal = '|encFile|';
			break;
		case 'encMediaFile1':
			$addiJud = true;	$addiMode = 1;		$addiVal = '|encMediaFile|';
			break;
		case 'encMediaFile0':
			$addiJud = true;	$addiMode = 0;		$addiVal = '|encMediaFile|';
			break;
		case 'contentImg1':
			$addiJud = true;	$addiMode = 1;		$addiVal = '|contentImg|';
			break;
		case 'contentImg0':
			$addiJud = true;	$addiMode = 0;		$addiVal = '|contentImg|';
			break;
		case 'resBaidu': case 'res360': case 'resSogou': case 'resShenma': case 'resToutiao': case 'resBing':
			AppChinaz::ResCheck($moreSetTo, $whereStr, $backURL);
			exit;
		case 'importTxt': case 'importTxt2':
			AppInfoImport::Daochu($moreSetTo, $whereStr, $backURL);
			exit;
		case 'checkImgErr': case 'autoImg': case 'autoImgFull': case 'delAutoImg': case 'delImg':
			AppAutoImg::InfoDeal($moreSetTo, $whereStr, $backURL);
			exit;
		case 'tagFc': case 'tagLocal':
			MoreSet_tag($moreSetTo, $whereStr, $backURL);
			exit;
		case 'contImgFile':
			MoreSet_contImgFile($moreSetTo, $whereStr, $backURL);
			exit;
		case 'imgSaveWeb': case 'imgSaveAliyun': case 'imgSaveQiniu': case 'imgSaveUpyun': case 'imgSaveFtp':
			MoreSet_imgSave($moreSetTo, $whereStr, $backURL);
			exit;
		default :
			JS::AlertBackEnd('目的不明确.');
			break;
	}

	if ($addiJud){
		$judRes = true;
		$chkexe = $DB->query('select IF_ID,IF_addition from '. OT_dbPref .'info where IF_ID in (0'. $whereStr .')');
		while ($rs = $chkexe->fetch()){
			if ($addiMode == 0){
				$DB->query('update '. OT_dbPref .'info set IF_addition='. $DB->ForStr( str_replace($addiVal, '', $rs['IF_addition']) ) .' where IF_ID='. $rs['IF_ID']);
			}elseif ($addiMode == 1){
				if (strpos($rs['IF_addition'],$addiVal) === false){
					$DB->query('update '. OT_dbPref .'info set IF_addition='. $DB->ForStr( $rs['IF_addition'] . $addiVal ) .' where IF_ID='. $rs['IF_ID']);
				}
			}
		}
		unset($chkexe);
	}else{
		$judRes = $DB->query('update '. OT_dbPref .'info set '. $dealStr .' where IF_ID in (0'. $whereStr .')');
	}

	if ($judRes){
		$alertRes = '成功';
	}else{
		$alertRes = '失败';
	}

	Adm::AddLog(array(
		'note'		=> '【'. $dataTypeCN .'】批量设置成【'. $moreSetToCN .'】'. $alertRes .'！',
		));

	JS::AlertHref('批量设置成【'. $moreSetToCN .'】'. $alertRes .'.',$backURL);
}



// 批量设置 标签获取
function MoreSet_tag($moreSetTo, $whereStr, $backURL){
	global $DB;

	require(OT_ROOT .'inc/classKeyWord.php');

	$succNum = $failNum = 0;
	$chkexe = $DB->query('select IF_ID,IF_theme,IF_tabID,IF_content from '. OT_dbPref .'info where IF_ID in (0'. $whereStr .')');
	while ($rs = $chkexe->fetch()){
		if ($rs['IF_tabID'] > 0){
			$IF_content	= Str::RegExp(Info::GetTabContent($rs['IF_tabID'], $rs['IF_ID']),'html');
		}else{
			$IF_content	= Str::RegExp($rs['IF_content'],'html');
		}
		if ($moreSetTo == 'tagFc'){
			$themeKey = KeyWord::GetFc($rs['IF_theme'] . PHP_EOL . $IF_content, 5);
			if (strpos($themeKey,'分词字库缺失') !== false){
				JS::AlertBackEnd($themeKey .'或者选择[本地获取]');
			}
		}else{
			$themeKey = KeyWord::Get($rs['IF_theme']);
		}
		if (strlen($themeKey) > 0){
			$succNum ++;
			// $DB->UpdateParam('info', array('IF_themeKey'=>$themeKey), 'IF_ID='. $rs['IF_ID'], 'errDie');
			$DB->query('update '. OT_dbPref .'info set IF_themeKey='. $DB->ForStr($themeKey) .' where IF_ID='. $rs['IF_ID']);
		}else{
			$failNum ++;
		}
	}
	unset($chkexe);
	JS::AlertHref('【'. $moreSetToCN .'】成功 '. $succNum .' 条，失败 '. $failNum .' 条.',$backURL);
}



// 批量设置 检测正文图片和附件数量
function MoreSet_contImgFile($moreSetTo, $whereStr, $backURL){
	global $DB;

	$dataNum = 0;
	$resexe = $DB->query('select IF_ID,IF_tabID,IF_content,IF_fileStr,IF_img from '. OT_dbPref .'info where IF_ID in (0'. $whereStr .')');
	while ($row = $resexe->fetch()){
		$dataNum ++;
		if ($row['IF_tabID'] > 0){
			$content = $DB->GetOne('select IC_content from '. OT_dbPref .'infoContent'. $row['IF_tabID'] .' where IC_ID='. $row['IF_ID']);
		}else{
			$content = $row['IF_content'];
		}

		$imgNumArr = Content::CalcImgNum($content);
		$fileNumArr = Info::CalcFileNum($row['IF_fileStr']);
		$imgMode = Info::ImgMode($row['IF_img']);

		$record = array();
		$record['IF_imgMode']		= $imgMode;
		$record['IF_imgNum']		= $imgNumArr['total'];
		$record['IF_imgHttpNum']	= $imgNumArr['httpNum'];
		$record['IF_imgOssNum']		= $imgNumArr['ossNum'];
		$record['IF_imgLocalNum']	= $imgNumArr['localNum'];
		$record['IF_fileNum']		= $fileNumArr['total'];
		$record['IF_fileHttpNum']	= $fileNumArr['httpNum'];
		$record['IF_fileOssNum']	= $fileNumArr['ossNum'];
		$record['IF_fileLocalNum']	= $fileNumArr['localNum'];
		$DB->UpdateParam('info',$record,'IF_ID='. $row['IF_ID']);

	}
	unset($resexe);

	JS::AlertHref('检测正文图片和附件数量信息 '. $dataNum .' 条.',$backURL);
}



// 批量设置 检测正文图片和附件数量
function MoreSet_imgSave($moreSetTo, $whereStr, $backURL){
	global $DB;

	$ossName = strtolower(str_replace('imgSave','',$moreSetTo));
	$ossUrlArr = AreaApp::OssUrlArr();
	$sysImagesArr = Cache::PhpFile('sysImages');
	$SaveImg = new SaveImg();
	$SaveImg->saveOss = $ossName;

	$dataNum = $contSuccNum = $contFailNum = $imgSuccNum = $imgFailNum = 0;
	$resexe = $DB->query('select IF_ID,IF_tabID,IF_content,IF_fileStr,IF_imgMode,IF_img from '. OT_dbPref .'info where IF_ID in (0'. $whereStr .')');
	while ($row = $resexe->fetch()){
		$dataNum ++;
		if ($row['IF_tabID'] > 0){
			$content = $DB->GetOne('select IC_content from '. OT_dbPref .'infoContent'. $row['IF_tabID'] .' where IC_ID='. $row['IF_ID']);
		}else{
			$content = $row['IF_content'];
		}
		$IF_img = $row['IF_img'];

		$contImgJud = $imgJud = false;

		// 获取正文内容图片信息
		$imgArr = Content::GetImgArr($content);
		$imgCount = count($imgArr);
		if ($moreSetTo == 'imgSaveWeb'){
			// 处理正文图片
			if ($imgCount > 0){
				foreach ($imgArr as $img){
					if (Is::HttpUrl($img)){
						$newFileName = Info::NewCollFileName($sysImagesArr['SI_isDir'], File::GetExt($img));
						$srfArr	= $SaveImg->SaveRemoteFile(InfoImgAdminDir . $newFileName, $img, $newFileName, 0);
						if ($srfArr['res']){
							// if (strlen($srfArr['url']) > 3){
							//	$newImg = $srfArr['url'];
							// }else{
								$newImg = InfoImgAdminDir . $newFileName;
							// }
							$content = str_replace($img, $newImg, $content);
							$contImgJud = true;
							$contSuccNum ++;
						}else{
							$contFailNum ++;
						}
					}
				}
			}

			// 处理缩略图
			if ( ! in_array($row['IF_imgMode'], array(0,1,10)) ){
				$newFileName = Info::NewCollFileName($sysImagesArr['SI_isDir'], File::GetExt($row['IF_img']));
				$srfArr	= $SaveImg->SaveRemoteFile(InfoImgAdminDir . $newFileName, $row['IF_img'], $newFileName, 0);
				if ($srfArr['res']){
					// if (strlen($srfArr['url']) > 3){
					//	$IF_img = $srfArr['url'];
					// }else{
						$IF_img = $newFileName;
					// }
					$imgJud = true;
					$imgSuccNum ++;
				}else{
					$imgFailNum ++;
				}
			}

		}elseif (in_array($moreSetTo, array('imgSaveAliyun', 'imgSaveQiniu', 'imgSaveUpyun', 'imgSaveFtp'))){
			// 处理正文图片
			if ($imgCount > 0){
				foreach ($imgArr as $img){
					if (Is::HttpUrl($img)){
						$ossArr = AreaApp::OssUrlType($img, $ossUrlArr, 'arr');
						if (! empty($ossArr)){
							if ($ossName == $ossArr['type']){
								continue;
							}
						}
						$newFileName = Info::NewCollFileName($sysImagesArr['SI_isDir'], File::GetExt($img));
						$srfArr	= $SaveImg->SaveRemoteFile(InfoImgAdminDir . $newFileName, $img, $newFileName, 0);
						if ($srfArr['res']){
							if (strlen($srfArr['url']) > 3){
								$newImg = $srfArr['url'];
							}else{
								// $newImg = InfoImgAdminDir . $newFileName;
							}
							$content = str_replace($img, $newImg, $content);
							$contImgJud = true;
							$contSuccNum ++;
						}else{
							$contFailNum ++;
						}

					}else{
						$ossArr = AreaApp::OssDeal($ossName, str_replace(InfoImgAdminDir, '', $img), $img);
						if ($ossArr['res']){
							$newImg = $ossArr['path'];
							$content = str_replace($img, $newImg, $content);
							$contImgJud = true;
							$contSuccNum ++;
						}else{
							$contFailNum ++;
						}

					}
				}
			}

			// 处理缩略图
			if ($row['IF_imgMode'] > 0){
				if (Is::HttpUrl($row['IF_img'])){
					$isJixu = true;
					$ossArr = AreaApp::OssUrlType($row['IF_img'], $ossUrlArr, 'arr');
					if (! empty($ossArr)){
						if ($ossName == $ossArr['type']){
							$isJixu = false;
						}
					}
					if ($isJixu){
						$newFileName = Info::NewCollFileName($sysImagesArr['SI_isDir'], File::GetExt($row['IF_img']));
						$srfArr	= $SaveImg->SaveRemoteFile(InfoImgAdminDir . $newFileName, $row['IF_img'], $newFileName, 0);
						if ($srfArr['res']){
							if (strlen($srfArr['url']) > 3){
								$IF_img = $srfArr['url'];
							}else{
								// $IF_img = $newFileName;
							}
							$imgJud = true;
							$imgSuccNum ++;
						}else{
							$imgFailNum ++;
						}
					}
				}else{
					$ossArr = AreaApp::OssDeal($ossName, $row['IF_img'], InfoImgAdminDir . $row['IF_img']);
					if ($ossArr['res']){
						$IF_img = $ossArr['path'];
						$imgJud = true;
						$imgSuccNum ++;
					}else{
						$imgFailNum ++;
					}
				}
			}
		}

		$record = array();
		if ($contImgJud){
			if ($row['IF_tabID'] > 0){
				$DB->UpdateParam('infoContent'. $row['IF_tabID'], array('IC_content'=>$content), 'IC_ID='. $row['IF_ID']);
			}else{
				$record['IF_content']	= $content;
			}
			$imgNumArr = Content::CalcImgNum($content);
			$record['IF_imgNum']		= $imgNumArr['total'];
			$record['IF_imgHttpNum']	= $imgNumArr['httpNum'];
			$record['IF_imgOssNum']		= $imgNumArr['ossNum'];
			$record['IF_imgLocalNum']	= $imgNumArr['localNum'];
		}
		if ($imgJud){
			$record['IF_imgMode']	= Info::ImgMode($IF_img);
			$record['IF_img']		= $IF_img;
		}

		if (count($record) > 0){
			$DB->UpdateParam('info',$record,'IF_ID='. $row['IF_ID']);
		}

	}
	unset($resexe);

	JS::AlertHref($dataNum .' 篇文章，'. ($contSuccNum + $contFailNum) .' 张正文图片（成功'. $contSuccNum .'张，失败'. $contFailNum .'张）和 '. ($imgSuccNum + $imgFailNum) .' 缩略图图片（成功'. $imgSuccNum .'张，失败'. $imgFailNum .'张）保存至 '. AreaApp::OssTypeCN($ossName, $ossName .'网站') .'.',$backURL);
}


// 收录情况设置
function ResDeal(){
	global $DB,$mudi,$menuFileID,$menuTreeID,$dataType,$dataTypeCN,$systemArr;

	$dataType	= OT::GetStr('dataType');
	$dataTypeCN	= '手动设置收录情况';
	$dataID		= OT::GetInt2( OT::ParaArr('id') );
	$type		= OT::GetStr('type');
	$val		= OT::GetInt('val');

	if ($dataID <= 0){
		JS::AlertEnd('文章ID不对（'. $dataID .'）.');
	}
	/* if (! in_array($type, array('baidu','so','sogou','shenma','shenma'))){
		JS::AlertBackEnd('类型不对（'. $type .'）.');
	} */
	if (! in_array($val, array(1,11))){
		JS::AlertBackEnd('值不对（'. $val .'）.');
	}
	switch ($type){
		case 'baidu':
			$typeCN = '百度';
			$fieldStr = 'IF_resBaidu';
			break;
	
		case 'so':
			$typeCN = '360';
			$fieldStr = 'IF_res360';
			break;
	
		case 'sogou':
			$typeCN = '搜狗';
			$fieldStr = 'IF_resSogou';
			break;
	
		case 'shenma':
			$typeCN = '神马';
			$fieldStr = 'IF_resShenma';
			break;
	
		case 'toutiao':
			$typeCN = '头条';
			$fieldStr = 'IF_resToutiao';
			break;
	
		case 'bing':
			$typeCN = '必应';
			$fieldStr = 'IF_resBing';
			break;
	
		default :
			JS::AlertBackEnd('类型不对（'. $type .'）.');
			break;
	}

	$judRes = $DB->query('update '. OT_dbPref .'info set '. $fieldStr .'='. $val .' where IF_ID='. $dataID);
		if ($judRes){
			$alertRes = '成功';
		}else{
			$alertRes = '失败';
		}

	Adm::AddLog(array(
		'note'		=> '【'. $dataTypeCN .'】设置收录情况【'. $typeCN .'】'. $val .'！',
		));

	JS::DiyEnd('$id("'. $type . $dataID .'").innerHTML = \''. StrCN::ResCN($typeCN,$val) .'<span style="color:green;">✔</span>\';');
	// JS::AlertEnd('设置收录情况【'. $typeCN .'】'. $val .'.');
}



// 全部设置
function AllSetDeal(){
	global $DB,$mudi,$menuFileID,$menuTreeID,$dataType,$dataTypeCN,$systemArr;

	$backURL		= OT::GetStr('backURL');
	$dataType		= OT::GetStr('dataType');
	$dataTypeCN		= '文章';	// OT::PostStr('dataTypeCN')
	$moreSetTo		= OT::GetRegExpStr('type','sql');

	$addiJud = false;
	$addiMode = -1;
	$addiVal = '';
	switch ($moreSetTo){
		case 'contentImg1':
			$moreSetToCN = '【正文显示缩略图】全部打钩';
			$addiJud = true;	$addiMode = 1;		$addiVal = '|contentImg|';
			break;
		case 'contentImg0':
			$moreSetToCN = '【正文显示缩略图】全部不打钩';
			$addiJud = true;	$addiMode = 0;		$addiVal = '|contentImg|';
			break;
		case 'noMakeHtml1':
			$moreSetToCN = '【提交不生成静态页】全部打钩';
			$addiJud = true;	$addiMode = 1;		$addiVal = '|noMakeHtml|';
			break;
		case 'noMakeHtml0':
			$moreSetToCN = '【提交不生成静态页】全部不打钩';
			$addiJud = true;	$addiMode = 0;		$addiVal = '|noMakeHtml|';
			break;
		case 'noInfoType1':
			$moreSetToCN = '【栏目[文章设置覆盖]无效】全部打钩';
			$addiJud = true;	$addiMode = 1;		$addiVal = '|noInfoType|';
			break;
		case 'noInfoType0':
			$moreSetToCN = '【栏目[文章设置覆盖]无效】全部不打钩';
			$addiJud = true;	$addiMode = 0;		$addiVal = '|noInfoType|';
			break;
		default :
			JS::AlertBackEnd('目的不明确['. $moreSetTo .'].');
			break;
	}

	if ($addiJud){
		$judRes = true;
		$chkexe = $DB->query('select IF_ID,IF_addition from '. OT_dbPref .'info where IF_addition'. ($addiMode == 1 ? ' not' : '') .' like "%'. $addiVal .'%"');
		while ($rs = $chkexe->fetch()){
			if ($addiMode == 0){
				$DB->query('update '. OT_dbPref .'info set IF_addition='. $DB->ForStr( str_replace($addiVal, '', $rs['IF_addition']) ) .' where IF_ID='. $rs['IF_ID']);
			}elseif ($addiMode == 1){
				$DB->query('update '. OT_dbPref .'info set IF_addition='. $DB->ForStr( $rs['IF_addition'] . $addiVal ) .' where IF_ID='. $rs['IF_ID']);
			}
		}
		unset($chkexe);
	}else{
		$judRes = $DB->query('update '. OT_dbPref .'info set '. $dealStr .'');
	}

	if ($judRes){
		$alertRes = '成功';
	}else{
		$alertRes = '失败';
	}

	Adm::AddLog(array(
		'note'		=> '【'. $dataTypeCN .'】全部设置成【'. $moreSetToCN .'】'. $alertRes .'！',
		));

	// JS::AlertHref('全部设置成【'. $moreSetToCN .'】'. $alertRes .'.',$backURL);
	JS::AlertCloseEnd('全部设置成【'. $moreSetToCN .'】'. $alertRes .'.');
}



function PostUrl($api,$urls){
	$ch = curl_init();
	$options =  array(
		CURLOPT_URL => $api,
		CURLOPT_POST => true,
		CURLOPT_RETURNTRANSFER => true,
		CURLOPT_POSTFIELDS => $urls,
		CURLOPT_HTTPHEADER => array('Content-Type: text/plain'),
	);
	curl_setopt_array($ch, $options);
	return curl_exec($ch);
}
?>